using System;
using UMC.Data;
using UMC.Net;

namespace UMC.Bridge
{
      public partial class BridgeSite : Record
    {
        public int? Key
        {
            get; set;
        }
        public StringValue Distributor
        {
            get; set;
        }
        public StringValue InputSize
        {
            get; set;
        }
        public StringValue OutputSize
        {
            get; set;
        }

        public long? AllowSize
        {
            get; set;
        }
        public StringValue Time { get; set; } //= StringValue.Empty;


        readonly static Action<BridgeSite, object>[] _SetValues = new Action<BridgeSite, object>[] { (r, t) => r.AllowSize = Reflection.ParseObject(t, r.AllowSize), (r, t) => r.Distributor = Reflection.ParseObject(t, r.Distributor), (r, t) => r.InputSize = Reflection.ParseObject(t, r.InputSize), (r, t) => r.Key = Reflection.ParseObject(t, r.Key), (r, t) => r.OutputSize = Reflection.ParseObject(t, r.OutputSize), (r, t) => r.Time = Reflection.ParseObject(t, r.Time) };
        readonly static string[] _Columns = new string[] { "AllowSize", "Distributor", "InputSize", "Key", "OutputSize", "Time" };
        protected override void SetValue(string name, object obv)
        {
            var index = Utility.Search(_Columns, name, StringComparer.CurrentCultureIgnoreCase);
            if (index > -1) _SetValues[index](this, obv);
        }
        protected override void GetValues(Action<String, object> action)
        {
            AppendValue(action, "AllowSize", this.AllowSize);
            AppendValue(action, "Distributor", this.Distributor);
            AppendValue(action, "InputSize", this.InputSize);
            AppendValue(action, "Key", this.Key);
            AppendValue(action, "OutputSize", this.OutputSize);
            AppendValue(action, "Time", this.Time);
        }

        protected override RecordColumn[] GetColumns()
        {
            var cols = new RecordColumn[6];
            cols[0] = RecordColumn.Column("AllowSize", this.AllowSize);
            cols[1] = RecordColumn.Column("Distributor", this.Distributor);
            cols[2] = RecordColumn.Column("InputSize", this.InputSize);
            cols[3] = RecordColumn.Column("Key", this.Key);
            cols[4] = RecordColumn.Column("OutputSize", this.OutputSize);
            cols[5] = RecordColumn.Column("Time", this.Time);
            return cols;
        }


    }
}
